﻿/*-----------------------------------------------------------------------
 * <copyright file="WCFMatterCorrelation.svc.cs" company="O-RID">
 *     Copyright (c)2010 O-RID Co.,Ltd.
 * </copyright>
 * <author>Zhang Jun</author>
 * <summary>
 *          所有与 账票类、工程类 信息操作相关的所有服务的定义
 *          StatisticsToolsDB_new 数据库
 *
 *          作成日：08/06/2010
 *                  08/13/2010 增加 JOB化率查询
 *                  08/20/2010 增加 稼动率查询  
 *                  08/25/2010 增加 帳票別情報 查询
 *                  09/09/2010 增加 帳票工程別情報 查询
 * </summary>
 *-----------------------------------------------------------------------
 */
namespace Orid.Management.Statistics.Service.OPUnitService.MatterCorrelation
{
    using System;
    using System.Collections.Generic;
    using System.ServiceModel;
    using System.ServiceModel.Activation;
    using Orid.Management.Statistics.Service.OPUnitService.MatterCorrelation.ServiceModel;
     
    /// <summary>
    /// 注意: 如果更改此处的类名 "WCFMatterCorrelation"，也必须更新 Web.config 中对 "WCFMatterCorrelation" 的引用。
    /// </summary>
    [ServiceBehavior(IncludeExceptionDetailInFaults = true)]
    [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class WCFMatterCorrelation : IWCFMatterCorrelation
    {
      
        #region 工程別言語別生産性
        /// <summary>
        /// 工程別言語別生産性
        /// </summary>
        /// <param name="whereParameter">The where parameter.</param>
        /// <returns></returns>
        public List<EngineeringLanguageProData> SelectEngineeringLanguageProQueryInfor(WhereParameters whereParameter) 
        {
            try
            {
                #region 参数形式转换
                ////日期
                if (!whereParameter.WhereDateFrom.Equals("null"))
                {
                    whereParameter.WhereDateFrom = whereParameter.WhereDateFrom.ToString().Trim();
                }

                if (!whereParameter.WhereDateTo.Equals("null"))
                {
                    whereParameter.WhereDateTo = whereParameter.WhereDateTo.ToString().Trim();
                }

                //LINE
                if (String.IsNullOrEmpty(whereParameter.WhereServer))
                {
                    whereParameter.WhereServer = string.Empty;
                }
                else
                {
                    whereParameter.WhereServer = whereParameter.WhereServer.ToString().Trim();
                }

                // 相差天数
                if (whereParameter.DateDiffs < 0) 
                {
                    whereParameter.DateDiffs = 0;
                }


                #endregion 参数设置

                return DataProvider.GetSelectEngineeringLanguageProQueryInfor(whereParameter);
            }
            catch (Exception ex)
            {
                Log4Service.Log log = new Orid.Management.Statistics.Service.Log4Service.Log();
                log.Error("WCFMatterCorrelation SelectEngineeringLanguageProQueryInfor Error:" + ex.Message);
            }

            return null;
        }
        #endregion 工程別言語別生産性

        #region JOB化率查询
        /// <summary>
        /// ジョブ化率 查询
        /// </summary>
        /// <param name="whereParameter">The where parameter.</param>
        /// <returns></returns>
        public List<JobRateData> SelectJobRateQueryInfor(WhereParameters whereParameter)
        {
            try
            {
                #region 参数形式转换
                ////日期
                if (!whereParameter.WhereDateFrom.Equals("null"))
                {
                    whereParameter.WhereDateFrom = whereParameter.WhereDateFrom.ToString().Trim();
                }

                if (!whereParameter.WhereDateTo.Equals("null"))
                {
                    whereParameter.WhereDateTo = whereParameter.WhereDateTo.ToString().Trim();
                }

                //LINE
                if (String.IsNullOrEmpty(whereParameter.WhereServer))
                {
                    whereParameter.WhereServer = string.Empty;
                }
                else
                {
                    whereParameter.WhereServer = whereParameter.WhereServer.ToString().Trim();
                }

                // 相差天数
                if (whereParameter.DateDiffs < 0)
                {
                    whereParameter.DateDiffs = 0;
                }


                #endregion 参数设置

                return DataProvider.GetSelectJobRateQueryInfor(whereParameter);
            }
            catch (Exception ex)
            {
                Log4Service.Log log = new Orid.Management.Statistics.Service.Log4Service.Log();
                log.Error("WCFMatterCorrelation SelectJobRateQueryInfor Error:" + ex.Message);
            }

            return null;
        }
        #endregion JOB化率查询

        #region 稼动率查询
        /// <summary>
        /// 稼动率查询
        /// </summary>
        /// <param name="whereParameter">The where parameter.</param>
        /// <returns></returns>
        /// <value>08/20/2010 增加</value>
        public List<WorkEfficiencyQueryData>SelectReportWorkEfficiencyQueryInfor(WhereParameters whereParameter) 
        {
            try
            {
                #region 参数形式转换
                ////日期
                if (!whereParameter.WhereDateFrom.Equals("null"))
                {
                    whereParameter.WhereDateFrom = whereParameter.WhereDateFrom.ToString().Trim();
                }

                if (!whereParameter.WhereDateTo.Equals("null"))
                {
                    whereParameter.WhereDateTo = whereParameter.WhereDateTo.ToString().Trim();
                }

                //LINE
                if (String.IsNullOrEmpty(whereParameter.WhereServer))
                {
                    whereParameter.WhereServer = string.Empty;
                }
                else
                {
                    whereParameter.WhereServer = whereParameter.WhereServer.ToString().Trim();
                }

                // 相差天数
                if (whereParameter.DateDiffs < 0)
                {
                    whereParameter.DateDiffs = 0;
                }

                #endregion 参数设置

                return DataProvider.GetSelectReportWorkEfficiencyQueryInfor(whereParameter);
            }
            catch (Exception ex)
            {
                Log4Service.Log log = new Orid.Management.Statistics.Service.Log4Service.Log();
                log.Error("WCFMatterCorrelation SelectReportWorkEfficiencyQuery Error:" + ex.Message);
            }
            return null;
        }
        #endregion 稼动率查询

        #region  帳票別情報
        /// <summary>
        /// 帳票別情報
        /// </summary>
        /// <param name="whereParameter">The where parameter.</param>
        /// <returns></returns>
        /// <value>帳票別情報</value>
        public List<FormInforQueryData> SelectFormInforQueryInfor(WhereParameters whereParameter) 
        {
            try
            {
                #region 参数形式转换
                ////日期
                if (!whereParameter.WhereDateFrom.Equals("null"))
                {
                    whereParameter.WhereDateFrom = whereParameter.WhereDateFrom.ToString().Trim();
                }

                if (!whereParameter.WhereDateTo.Equals("null"))
                {
                    whereParameter.WhereDateTo = whereParameter.WhereDateTo.ToString().Trim();
                }

                // 相差天数
                if (whereParameter.DateDiffs < 0)
                {
                    whereParameter.DateDiffs = 0;
                }

                // Count
                if (whereParameter.Count <= 0) 
                {
                    whereParameter.Count = 0;
                }
                

                #endregion 参数设置

                return DataProvider.GetSelectFormInforQueryInfor(whereParameter);
            }
            catch (Exception ex)
            {
                Log4Service.Log log = new Orid.Management.Statistics.Service.Log4Service.Log();
                log.Error("WCFMatterCorrelation SelectFormInforQueryInfor Error:" + ex.Message);
            }
            return null;
        }
        #endregion  帳票別情報

        #region 帳票工程別情報
        /// <summary>
        /// 帳票工程別情報 查询
        /// </summary>
        /// <param name="whereParameter">The where parameter.</param>
        /// <returns></returns>
        /// <value>09/09/2010 增加 </value>
        public List<FormInforBasedData> SelectFormProjectQueryInfor(WhereParameters whereParameter) 
        {
            try
            {
                #region 参数形式转换
                ////日期
                if (!whereParameter.WhereDateFrom.Equals("null"))
                {
                    whereParameter.WhereDateFrom = whereParameter.WhereDateFrom.ToString().Trim();
                }

                if (!whereParameter.WhereDateTo.Equals("null"))
                {
                    whereParameter.WhereDateTo = whereParameter.WhereDateTo.ToString().Trim();
                }

                // 相差天数
                if (whereParameter.DateDiffs < 0)
                {
                    whereParameter.DateDiffs = 0;
                }

                // Count
                if (whereParameter.Count <= 0)
                {
                    whereParameter.Count = 0;
                }
                #endregion 参数设置

                return DataProvider.GetSelectFormProjectQueryInfor(whereParameter);
            }
            catch (Exception ex)
            {
                Log4Service.Log log = new Orid.Management.Statistics.Service.Log4Service.Log();
                log.Error("WCFMatterCorrelation SelectFormProjectQueryInfor Error:" + ex.Message);
            }
            return null;
        }

        #endregion 帳票工程別情報
    }
}
